<?php
require './core/conn.php';
$sql = "TRUNCATE TABLE msg ";
$r = mysqli_query($conn, $sql); // 执行SQL语句
if ($r) { // 如果SQL语句执行成功
    exit('<script language="javascript">alert("清空成功！");self.location = "admin.php";</script>');
} else {
    echo "<script type='text/javascript'>alert('清空失败');history.back();</script>"; // 弹窗
}
mysqli_close($conn); // 关闭数据库的连接
?>